package BiShi.huawei;



        import java.util.*;

public class Main {
    static int cnt = 0;
    public static void main(String[] args) {
        LinkedHashMap<String, Integer> map = new LinkedHashMap<String, Integer>();

        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            String[] str = sc.nextLine().split(",");
            String res = "";
            int cnt = 0;
            boolean val = true;
            for (String s: str) {
                if(!isval(s)){
                    val = false;
                    break;
                }
                if(map.containsKey(s)){
                    map.put(s, map.get(s)+1);
                }else{
                    map.put(s, 1);
                }
            }
            for (String s : map.keySet()){
                if(cnt < map.get(s)){
                    cnt = map.get(s);
                    res = s;
                }else if(cnt == map.get(s)){
                    if(helper(s, res) < 0){
                        res = s;
                    }
                }
            }

            if(val){
                System.out.println(res);
            }else{
                System.out.println("error.0001");
            }

        }
    }

    private static boolean isval(String s) {
        if(s.charAt(0) >= 'A' && s.charAt(0) <= 'Z' ){
            int i;
            for ( i = 0; i< s.length();i++){
                if(s.charAt(i) >= 'a' && s.charAt(i) <= 'z' );
                continue;
            }
            if(i==s.length()){
                return true;
            }
        }
        return false;
    }

    private static int helper(String s, String res) {
        return s.compareTo(res);
    }
}
